﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Test Configuration </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Test Configuration ">
    <meta name="generator" content="docfx 2.45.1.0">
    
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="">
    <meta property="docfx:tocrel" content="toc.html">
    <meta property="docfx:rel" content="../">
    <meta property="og:title" content="Flexible and asynchronous testing framework for ASP.NET Core MVC">
    <meta property="og:site_name" content="My Tested ASP.NET Core MVC Docs">
    <meta property="og:url" content="http://docs.mytestedasp.net/">
    <meta property="og:description" content="A fluent unit testing library for ASP.NET Core MVC">
    <meta property="og:image" content="https://mytestedasp.net/Content/Images/logosocial.jpg">
    <meta property="og:type" content="website">
    <meta property="og:locale" content="en_US">
    <meta property="twitter:card" content="summary">
    <meta property="twitter:title" content="Flexible and asynchronous testing framework for ASP.NET Core MVC">
    <meta property="twitter:description" content="A fluent unit testing library for ASP.NET Core MVC">
    <meta property="twitter:creator" content="@MyTestedASPNET">
    <meta property="twitter:url" content="https://mytestedasp.net/">
    <meta property="twitter:image" content="https://mytestedasp.net/Content/Images/logosocial.jpg">
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="../index.html">
                MY TESTED ASP.NET CORE MVC DOCS
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="">
<h1 id="test-configuration">Test Configuration</h1>

<p>In this section we are going to examine the test configuration or the <strong>&quot;testsettings.json&quot;</strong> file we used to provide a license key for the library.</p>
<h2 id="startup-class">Startup class</h2>
<p>One of the features you can control from the test configuration is how you register the application services. There are three ways:</p>
<ul>
<li><p><strong>Automatic Startup class</strong> - the default option, we used it during this tutorial</p>
</li>
<li><p><strong>Manual Startup class</strong> - if the test runner of your choice supports assembly initialization you may choose to use this option like in the <a href="https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/development/samples/ApplicationParts">ApplicationParts</a> sample</p>
</li>
</ul>
<pre><code class="lang-json">{
  &quot;General&quot;: {
    &quot;AutomaticStartup&quot;: false
  }
}
</code></pre><ul>
<li><strong>No Startup class</strong> - you may choose not to use global services at all and provide them in each test explicitly like in the <a href="https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc/tree/development/samples/NoStartup">NoStartup</a> sample</li>
</ul>
<pre><code class="lang-json">{
  &quot;General&quot;: {
    &quot;NoStartup&quot;: true
  }
}
</code></pre><p>More information is available <a href="/guide/startuptypes.html">HERE</a>!</p>
<h2 id="general-settings">General settings</h2>
<p>Various general settings are available for you to explore:</p>
<pre><code class="lang-json">{
  &quot;General&quot;: {
    &quot;Environment&quot;: &quot;CustomEnvironment&quot;,
    &quot;ApplicationName&quot;: &quot;Custom Application Name&quot;,
    &quot;StartupType&quot;: &quot;CustomStartupType&quot;,
    &quot;AsynchronousTests&quot;: false,
    &quot;WebAssemblyName&quot;: &quot;MyApp&quot;,
    &quot;TestAssemblyName&quot;: &quot;MyApp.Test&quot;,
    &quot;AutomaticApplicationParts&quot;: true
  }
}
</code></pre><p>More information is available <a href="/guide/testconfig.html">HERE</a>.</p>
<h2 id="specific-settings">Specific settings</h2>
<p>Different components have different test configuration. For example, you may disable the automatic model validation in every action call:</p>
<pre><code class="lang-json">{
  &quot;Controllers&quot;: {
    &quot;ModelStateValidation&quot;: false
  }
}
</code></pre><p>More information is available <a href="/guide/testconfig.html">HERE</a>.</p>
<h2 id="section-summary">Section summary</h2>
<p>This section introduced you to the test configuration. We have one last part - custom <a href="/tutorial/extensionmethods.html">Extension Methods</a>!</p>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                  <li>
                    <a href="https://github.com/tmollov/MyTested.AspNetCore.Mvc/blob/development/docs/_docfx/tutorial/testconfig.md/#L1" class="contribution-link">Improve this Doc</a>
                  </li>
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
              <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
              </nav>
            </div>
          </div>
        </div>
      </div>
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            <span>Copyright © 2015-2016 <strong><a href="http://mytestedasp.net">MyTestedASP.NET</a></strong>. All Rights Reserved. Generated by <strong><a href="http://dotnet.github.io/docfx/">DocFX</a></strong></span>
          </div>
        </div>
      </footer>
    </div>
    <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../styles/docfx.js"></script>
    <script type="text/javascript" src="../styles/main.js"></script>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-51720358-4', 'auto');
      ga('send', 'pageview');
    </script>
    <script>
    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
    n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
    document,'script','https://connect.facebook.net/en_US/fbevents.js');
    fbq('init', '884740311601716');
    fbq('track', 'PageView');
    </script>
    <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=884740311601716&ev=PageView&noscript=1"></noscript>  </body>
</html>
